<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>gif切换和css3动画</title>

  <style>
    .box{
      position: relative;
    }
    h1 {
      top: 10px;
      display: inline-block;
      font-size: 60px;
      color:#fff;
      font-weight: bold;
      font-family: '微软雅黑';
      font-style: italic;
      text-shadow: 4px 0 0 rgb(72, 206, 246);
      position: absolute;
      animation-name: myfirst;
      animation-duration: 1.4s;
      animation-timing-function: linear;
      animation-iteration-count: infinite;
      animation-direction: alternate;
      animation-play-state: running;

    }

   

    @keyframes myfirst {
      0% {
        text-shadow: 4px 1px 0 rgb(72, 206, 246);
        left: 0px;
      }

      100% {
        text-shadow: -4px 1px 0 rgb(246, 72, 95);
        left: 40px;
      }
    }
  </style>
</head>

<body>
  <div class="box">
  <img src="banner_1.gif" id="Img1" alt="">
  <img src="banner_cloud.gif" id="Img2" alt="" style="display: none;" />
  <h1>快看我动来动去</h1>
  </div>
</body>
<script>
  window.onload = function () {
    var oimg = document.getElementById('Img1');
    var cimg = document.getElementById('Img2');
    function change() {
      //oimg.src = "./banner_cloud.gif";
      cimg.style.display = 'inline';
      oimg.remove();

    }
    setTimeout(change, 2800);
  }
</script>

</html>
